﻿<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:xrd="clr-namespace:CodeReason.Reports.Document;assembly=CodeReason.Reports" 
              PageHeight="29.7cm" PageWidth="21cm" ColumnWidth="21cm">
    <xrd:ReportProperties>
        <xrd:ReportProperties.ReportName>ProductsReport</xrd:ReportProperties.ReportName>
        <xrd:ReportProperties.ReportTitle>Product List</xrd:ReportProperties.ReportTitle>
    </xrd:ReportProperties>
    <Section Padding="80,10,40,10" FontSize="12">
        <Paragraph FontSize="24" FontWeight="Bold">
            <xrd:InlineContextValue PropertyName="ReportTitle" />
        </Paragraph>
        <xrd:SectionDataGroup DataGroupName="ItemList">
            <Table CellSpacing="0" BorderBrush="Black" BorderThickness="0.02cm">
                <Table.Resources>
                    <!-- Style for header/footer rows. -->
                    <Style x:Key="headerFooterRowStyle" TargetType="{x:Type TableRowGroup}">
                        <Setter Property="FontWeight" Value="DemiBold"/>
                        <Setter Property="FontSize" Value="16"/>
                        <Setter Property="Background" Value="LightGray"/>
                    </Style>

                    <!-- Style for data rows. -->
                    <Style x:Key="dataRowStyle" TargetType="{x:Type TableRowGroup}">
                        <Setter Property="FontSize" Value="12"/>
                    </Style>

                    <!-- Style for data cells. -->
                    <Style TargetType="{x:Type TableCell}">
                        <Setter Property="Padding" Value="0.1cm"/>
                        <Setter Property="BorderBrush" Value="Black"/>
                        <Setter Property="BorderThickness" Value="0.01cm"/>
                    </Style>
                </Table.Resources>

                <Table.Columns>
                    <TableColumn Width="0.5*" />
                    <TableColumn Width="2*" />
                    <TableColumn Width="*" />
                    <TableColumn Width="0.5*" />
                </Table.Columns>
                <TableRowGroup Style="{StaticResource headerFooterRowStyle}">
                    <TableRow>
                        <TableCell>
                            <Paragraph TextAlignment="Center">
                                <Bold>Ref</Bold>
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph TextAlignment="Center">
                                <Bold>Name</Bold>
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph TextAlignment="Center">
                                <Bold>Cost</Bold>
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph TextAlignment="Center">
                                <Bold>Price</Bold>
                            </Paragraph>
                        </TableCell>
                    </TableRow>
                </TableRowGroup>
                <TableRowGroup Style="{StaticResource dataRowStyle}">
                    <xrd:TableRowForDataTable TableName="Products">
                        <TableCell>
                            <Paragraph>
                                <xrd:InlineTableCellValue PropertyName="Reference" />
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph>
                                <xrd:InlineTableCellValue PropertyName="Name" />
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph>
                                <xrd:InlineTableCellValue PropertyName="BuyPrice"/>
                            </Paragraph>
                        </TableCell>
                        <TableCell>
                            <Paragraph TextAlignment="Center">
                                <xrd:InlineTableCellValue PropertyName="SellPrice"/>
                            </Paragraph>
                        </TableCell>
                    </xrd:TableRowForDataTable>
                </TableRowGroup>
            </Table>
        </xrd:SectionDataGroup>
    </Section>
</FlowDocument>
